import request from "@/utils/request";

//获取商品分类列表
export function category() {
  return request({
    url: "/commodity/category/showProductCategory",
    method: "get",
  });
}
//根据分类搜索
export function categoryGoods(data) {
  return request({
    url: "/commodity/goods/categoryGoods/lists",
    method: "get",
    params: data,
  });
}
// 查询商城商品列表
export function listProduct(data) {
  return request({
    url: "/commodity/product/mallProductList",
    method: "post",
    data,
  });
}

// 删除商城商品
export function delProduct(mallId) {
  return request({
    url: "/commodity/product/" + mallId,
    method: "delete",
  });
}
//议价列表
export function bargainList(data) {
  return request({
    url: "/commodity/bargainList",
    method: "get",
    params: data,
  });
}
//支付方式列表
export function showHomePayType(query) {
  return request({
    // url: "/home/product/showHomePayType",
    url: "/mall/changePayType",
    method: "get",
    params: query,
  });
}
//提交商品
export function saveMallProduct(data) {
  return request({
    url: "/commodity/product/saveMallProduct",
    method: "post",
    data,
  });
}

//获取本地商品列表
export function showLocalMallProduct(data) {
  return request({
    url: "/commodity/showLocalMallProduct",
    method: "post",
    data,
  });
}
//修改价格
export function batchChangePrice(data, config) {
  return request({
    url: "/commodity/product/batchChangePrice",
    method: "post",
    data,
    config,
  });
}
//是否上架
export function updateIsShow(data, config) {
  return request({
    url: "/commodity/product/updateIsShow",
    method: "put",
    data,
    config,
  });
}
//同步分类

export function syncCategory() {
  return request({
    url: "/commodity/category/synProductCategory",
    method: "put",
  });
}
//是否热卖
export function updateIsHotSale(data) {
  return request({
    url: "/commodity/product/updateIsHotSale",
    method: "put",
    data,
  });
}
//是否热卖
export function updateIsRecommend(data) {
  return request({
    url: "/commodity/product/updateIsRecommend",
    method: "put",
    data,
  });
}
//子商城登录
export function mallIndex(data) {
  return request({
    url: "/system/mallLogin/mallIndex",
    method: "post",
    data,
  });
}

// 修改库存
export function changeLocalStockNum(data) {
  return request({
    url: "commodity/product/updateLocalStockNum",
    method: "put",
    data,
  });
}
// 修改排序
export function changeSort(data) {
  return request({
    url: "commodity/product/updateLocalSort",
    method: "put",
    data,
  });
}
//品牌列表
export function showBrandList() {
  return request({
    url: "commodity/brand/showAllBrandList",
    method: "get",
  });
}
//扣点品牌
export function showPointBuckleList() {
  return request({
    url: "commodity/point/showPointBuckleList",
    method: "get",
  });
}

//返现列表
export function showBankPriceList() {
  return request({
    url: "commodity/bankPrice/showBankPriceList",
    method: "get",
  });
}
//批量上架
export function allUp(data) {
  return request({
    url: "commodity/product/updateLocalSort",
    method: "put",
    data,
  });
}
